import $http from '@/common/utils/http.ts'
import type { Result, List } from '../types/common'
import type { SearchParams, cartUsersItem } from '../types/cartUsers'

export const cartUsersService = {
    async createCartUsersService(params: cartUsersItem) {
        const url: string = `/api/cartUsers/createCartUsers`

        return await $http.post(url, params) as Result<number>
    },

    async deleteCartUsersService(params: { userId: string | number }) {
        const url: string = `/api/cartUsers/deleteCartUsers`

        return await $http.del(url, params) as Result<number>
    },

    async updateCartUsersService(params: cartUsersItem) {
        const url: string = `/api/cartUsers/putCartUsers`

        return await $http.put(url, params) as Result<number>
    },

    /**  查询 */
    async getCartUsersService(params: SearchParams) {
        const url: string = `/api/cartUsers/getCartUsers`

        return await $http.get(url, params) as Result<List<cartUsersItem>>

    }
}